
#include "GraphicFactoryOGL.h"

namespace OGLs
{
	GraphicFactoryOGL::GraphicFactoryOGL(Window& win)
		:m_GraphicOGL(0)
	{
		m_GraphicOGL = new GraphicOGL(win);
	}

	GraphicFactoryOGL::~GraphicFactoryOGL(void)
	{
		if(m_GraphicOGL != 0)
		{
			delete m_GraphicOGL;
		}
	}

	
	Drawable* GraphicFactoryOGL::CreateDrawable(int width, int height)
	{
		Drawable* dd = 0;
		try
		{
			dd = new OGLs::DrawableOGL(*m_GraphicOGL,width,height);
		}	
		catch(...)
		{
			return 0;
		}
		return dd;
	}
	
	Drawable* GraphicFactoryOGL::CreateDrawable(const std::string& filename,DWORD colorKey)
	{
		Drawable* dd = 0;
		try
		{			
			dd = new OGLs::DrawableOGL(*m_GraphicOGL,filename,colorKey);
		
		}
		catch(...)
		{
			return 0;
		}
		return dd;
	}
	Graphics::Graphic2D * const GraphicFactoryOGL:: GetGraphic2D()
	{
		return m_GraphicOGL;
	}
}